<template>
  <!--  <div class ="app-container">-->

  <!--    <el-table :data="list" stripe style="width: 100%">-->
  <!--      <el-table-colum type="index" width="50"></el-table-colum>-->
  <!--      <el-table-colum prop="hosname" label="医院名称"/>-->
  <!--      <el-table-colum prop="hoscode" label="医院编码"/>-->
  <!--      <el-table-colum prop="apiUrl" width="200" label="医院名称"/>-->
  <!--      <el-table-colum prop="contactsName" label="联系人"/>-->
  <!--      <el-table-colum prop="contactsPhone" label="联系电话"/>-->
  <!--      <el-table-colum label="状态" width="50">-->
  <!--        <template slot-scope="scope">-->
  <!--          {{scope.row.status === 1 ? '可用' : '不可用'}}-->
  <!--        </template>-->
  <!--      </el-table-colum>-->
  <!--    </el-table>-->

  <!--  </div>-->

  <div class="app-container">
    <el-table v-loading="listLoading" :data="list" border fit highlight-current-row style="width: 100%">
      <el-table-column prop="id" align="center" label="ID" width="80">
        <template slot-scope="scope">
          <span>{{ scope.row.id }}</span>
        </template>
      </el-table-column>

      <el-table-column prop="createTime" width="180px" align="center" label="创建时间">
        <template slot-scope="scope">
          <span>{{ scope.row.createTime }}</span>
        </template>
      </el-table-column>
      <el-table-column width="180px" align="center" label="更新时间">
        <template slot-scope="scope">
          <span>{{ scope.row.updateTime }}</span>
        </template>
      </el-table-column>

      <el-table-column width="120px" align="center" label="医院名称">
        <template slot-scope="scope">
          <span>{{ scope.row.hosname }}</span>
        </template>
      </el-table-column>
      <el-table-column width="120px" align="center" label="医院编码">
        <template slot-scope="scope">
          <span>{{ scope.row.hoscode }}</span>
        </template>
      </el-table-column>

      <!--      <el-table-column width="100px" label="Importance">-->
      <!--        <template slot-scope="scope">-->
      <!--          <svg-icon v-for="n in +scope.row.importance" :key="n" icon-class="star" class="meta-item__icon" />-->
      <!--        </template>-->
      <!--      </el-table-column>-->

      <el-table-column class-name="status-col" label="状态" width="110">
        <template slot-scope="{row}">
          <el-tag :type="row.status">
            {{ row.status === 0 ? '可用' : '不可用' }}
          </el-tag>
        </template>
      </el-table-column>

      <!--      <el-table-column min-width="300px" label="Title">-->
      <!--        <template slot-scope="{row}">-->
      <!--          <router-link :to="'/hospital-setting/edit/'+row.id" class="link-type">-->
      <!--            <span>{{ row.title }}</span>-->
      <!--          </router-link>-->
      <!--        </template>-->
      <!--      </el-table-column>-->

      <el-table-column align="center" label="操作" width="120">
        <template slot-scope="scope">
          <router-link :to="'/hospital-setting/edit/'+scope.row.id">
            <el-button type="primary" size="small" icon="el-icon-edit">
              修改
            </el-button>
          </router-link>
        </template>
      </el-table-column>
    </el-table>

    <!--    <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />-->
  </div>
</template>

<script>
import hospitalSet from '@/api/hospital-setting'

export default {
  // 定义变量和初始值
  data() {
    return {
      list: null,
      total: 0,
      listLoading: true,
      listQuery: {
        page: 1,
        limit: 20,
        vo: {
          hosname: null,
          hoscode: '1001'
        },
        list: []
      }
    }
  },
  // 页面渲染之前执行 一般调用methods定义的方法，得到数据
  created() {
    this.getList()
  },
  // 定义方法，进行请求接口调用
  methods: {
    getList() {
      this.listLoading = true
      hospitalSet.findPage(this.listQuery.page, this.listQuery.limit, this.listQuery.vo).then(response => {
        console.log(response)
        console.log(response.data)
        this.list = response.data.records
        this.total = response.data.total
        this.listLoading = false
      }).catch(error => {
        // 请求失败
        console.log(error)
      })
    }
  }
}
</script>

<style scoped>
.edit-input {
  padding-right: 100px;
}
.cancel-btn {
  position: absolute;
  right: 15px;
  top: 10px;
}
</style>
